<ng-form name="secretsForm" class="osc-secrets-form">

  <div ng-if="strategyType !== 'Custom'">
    <div class="form-group">
      <div class="advanced-secrets">
        <div class="input-labels">
          <label class="input-label">
            Build Secret
          </label>
          <label class="input-label">
            Destination Directory
          </label>
        </div>
        <div ng-repeat="pickedSecret in pickedSecrets">
          <div class="secret-row">
            <div class="secret-name">
              <ui-select ng-required="pickedSecret.destinationDir" ng-model="pickedSecret.secret.name">
                <ui-select-match placeholder="Secret name">{{$select.selected}}</ui-select-match>
                <ui-select-choices repeat="secret in (secretsByType[type] | filter : $select.search)">
                  <div ng-bind-html="secret | highlight : $select.search"></div>
                </ui-select-choices>
              </ui-select>
            </div>
            <div class="destination-dir">
              <input class="form-control"
                id="destinationDir"
                name="destinationDir"
                ng-model="pickedSecret.destinationDir"
                type="text"
                placeholder="/"
                autocorrect="off"
                autocapitalize="none"
                spellcheck="false">
            </div>
            <div class="remove-secret">
              <a ng-click="removeSecret($index)"  href="" role="button" class="btn-remove">
                <span class="pficon pficon-close" aria-hidden="true"></span>
                <span class="sr-only">Remove build secret</span>
              </a>
            </div>
          </div>
        </div>
        <div class="help-blocks">
            <div class="help-block">Source secret to copy into the builder pod at build time.</div>
            <div class="help-block">Directory where the files will be available at build time.</div>
        </div>
      </div>
    </div>
  </div>

  <div ng-if="strategyType === 'Custom'">
    <div class="form-group">
      <div class="advanced-secrets">
        <div class="input-labels">
          <label class="input-label">
            Build Secret
          </label>
          <label class="input-label">
            Mount path
          </label>
        </div>
        <div ng-repeat="pickedSecret in pickedSecrets">
          <div class="secret-row">
            <div class="secret-name">
              <ui-select ng-required="pickedSecret.mountPath" ng-model="pickedSecret.secretSource.name">
                <ui-select-match placeholder="Secret name">{{$select.selected}}</ui-select-match>
                <ui-select-choices repeat="secret in (secretsByType[type] | filter : $select.search)">
                  <div ng-bind-html="secret | highlight : $select.search"></div>
                </ui-select-choices>
              </ui-select>
            </div>
            <div class="destination-dir">
              <input class="form-control"
                id="mountPath"
                name="mountPath"
                ng-model="pickedSecret.mountPath"
                type="text"
                placeholder="/"
                autocorrect="off"
                autocapitalize="none"
                spellcheck="false">
            </div>
            <div class="remove-secret">
              <a ng-click="removeSecret($index)"  href="" role="button" class="btn-remove">
                <span class="pficon pficon-close" aria-hidden="true"></span>
                <span class="sr-only">Remove build secret</span>
              </a>
            </div>
          </div>
        </div>
        <div class="help-blocks">
            <div class="help-block">Source secret to mount into the builder pod at build time.</div>
            <div class="help-block">Path at which to mount the secret.</div>
        </div>
      </div>
    </div>
  </div>
  <div class="osc-secret-actions">
    <span ng-if="canAddSourceSecret()">
      <a href=""
        role="button"
        ng-click="addSourceSecret()">Add Another Secret</a>
      <span ng-if="secretsVersion | canI : 'create'" class="action-divider">|</span>
    </span>
    <a href=""
      ng-if="secretsVersion | canI : 'create'"
      role="button"
      ng-click="openCreateSecretModal()">Create New Secret</a>
  </div>

</ng-form>
